//
//  YHGestureHelper.m
//  YHRongYiTong
//
//  Created by zxl on 2017/11/13.
//  Copyright © 2017年 YH. All rights reserved.
//

#import "YHGestureHelper.h"

@implementation YHGestureHelper

+ (void)addGesture:(UIView*)view
            Target:(id)t_target
               Sel:(SEL)t_sel{
    view.userInteractionEnabled=YES;
    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:t_target action:t_sel];
    [view addGestureRecognizer:singleTap];
}
    
+ (void)addTapGesture:(UIView*)view
               number:(NSInteger)number
               Target:(id)t_target
                  Sel:(SEL)t_sel{
    view.userInteractionEnabled=YES;
    UITapGestureRecognizer *doubleGesture =[[UITapGestureRecognizer alloc]initWithTarget:t_target action:t_sel];
    doubleGesture.numberOfTapsRequired=number;
    [view addGestureRecognizer:doubleGesture];
}
    
+ (void)addlongPressGesture:(UIView*)view
                     Target:(id)t_target
                        Sel:(SEL)t_sel{
    UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc]initWithTarget:t_target action:t_sel];
    longPressGestureRecognizer.numberOfTouchesRequired = 1;
    longPressGestureRecognizer.allowableMovement = 20.0f;
    longPressGestureRecognizer.minimumPressDuration = 1.0;
    [view addGestureRecognizer:longPressGestureRecognizer];
}
    
+ (void)addSwipeGesture:(UIView*)view
                 Target:(id)t_target
              direction:(UISwipeGestureRecognizerDirection)direction
                    Sel:(SEL)t_sel{
    view.userInteractionEnabled=YES;
    UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:t_target action:t_sel];
    [swipeGesture setDirection:(direction)];
    [view addGestureRecognizer:swipeGesture];
}

@end
